<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>笔记详情</title>
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="keywords" content="fly,layui,前端社区">
	<meta name="description" content="">
	<link rel="stylesheet" href="${pageContext.servletContext.contextPath}/layui/css/layui.css">
	<link rel="stylesheet" href="${pageContext.servletContext.contextPath}/static/css/global.css">
	<script src="${pageContext.servletContext.contextPath}/layui/layui.js"></script>
	<script src="${pageContext.servletContext.contextPath}/static/js/jquery-3.2.1.js"></script>
	<style type="text/css" rel="stylesheet">
		form {
			margin: 0;
		}
		.editor {
			margin-top: 5px;
			margin-bottom: 5px;
		}
	</style>
	<style type="text/css">
		.linear{
			background-image: linear-gradient(to right, #eea2a2 0%, #bbc1bf 19%, #57c6e1 42%, #b49fda 79%, #7ac5d8 100%);
		}
	</style>
</head>
<body class="linear">
<%--公共头部开始--%>
<jsp:include page="/WEB-INF/jsp/common/head.jsp"></jsp:include>
<%--公共头部结束--%>
<div class="main layui-clear">
	<div class="wrap">
		<div class="content detail">
			<div class="fly-panel detail-box">
				<h1>${note.title}</h1>
				<div class="fly-tip fly-detail-hint" data-id="">
				</div>
				<div class="detail-about">
					<a class="jie-user" href=""> <img src="${pageContext.servletContext.contextPath}/${touxiang}" alt="头像"> <cite> ${zuozhe}
						<em><fmt:formatDate value="${note.createtime}" pattern="yyyy-MM-dd HH:mm:ss" />分享</em> </cite> </a>
					<div class="detail-hits" data-id="{{rows.id}}">
					</div>
				</div>
				<div class="detail-body photos" style="margin-bottom: 20px;">
					<p>${note.content}</p>
				</div>
			</div>

			<div class="fly-panel detail-box" style="padding-top: 0;">
				<a name="comment"></a>
				<ul class="jieda photos" id="jieda">
					<c:choose>
						<c:when test="${coms != null}">
							<input type="hidden" id="obj" name="obj" value="${coms}">
							<c:forEach items="${coms}" var="com">
								<li data-id="12" class="jieda-daan">
									<div class="detail-about detail-about-reply">
										<a class="jie-user" href="javascript:;">
											<img src="${pageContext.servletContext.contextPath}/${com.avatar}" alt="">
											<cite> <i>${com.loginname}</i></cite>
										</a>
										<div class="detail-hits">
											<span><fmt:formatDate value="${com.createtime}" pattern="yyyy-MM-dd HH:mm:ss" /></span>
										</div>
										<i class="iconfont icon-caina" title="最佳答案"></i>
									</div>
									<div class="detail-body jieda-body">
										<p>${com.contents}</p>
									</div>
									<div class="jieda-reply">
										<span class="jieda-zan zanok" type="zan" id="zan" name="zan" onclick="zan('${com.id}')">
											<i class="iconfont icon-zan"></i><em class="em" id="em">${com.likes}</em>
										</span>
									</div>
								</li>
							</c:forEach>
						</c:when>
						<c:when test="${coms == null}">
							<li class="fly-none">没有任何回答</li>
						</c:when>
					</c:choose>

				</ul>

				<span id="toName">@ <span>${zuozhe}</span>(楼主)</span>
				<div class="layui-form layui-form-pane">
					<form action="${pageContext.servletContext.contextPath}/com/save" method="post">
						<input type="hidden" id="noteid" name="noteid" value="${note.id}">
						<div class="layui-form-item layui-form-text">
							<div class="layui-input-block">
								<textarea id="L_content" name="contents" placeholder="我要评论" class="layui-textarea fly-editor" style="height: 150px;"></textarea>
							</div>
						</div>
						<div class="layui-form-item">
							<button class="layui-btn" lay-filter="*" lay-submit>提交评论</button>
						</div>
					</form>
				</div>

			</div>
		</div>
	</div>

	<div class="edge">
		<!-- 天气 -->
		<div id="weather-view-he"></div>
		<script>
			WIDGET = {ID: 'boWh99L1N9'};
		</script>
		<script type="text/javascript" src="https://apip.weatherdt.com/view/static/js/r.js?v=1111"></script>
		<iframe frameborder="no" border="0" marginwidth="0" marginheight="0" width=350 height=450 src="//music.163.com/outchain/player?type=0&id=2981177242&auto=0&height=430"></iframe>
	</div>

</div>
<script type="text/javascript" charset="utf-8" src="${pageContext.servletContext.contextPath}/js/kindeditor.js"></script>
<script type="text/javascript">
	KE.show({
		id : 'L_content',
		resizeMode : 1,
		items : [
			'fontname', 'fontsize', 'textcolor', 'bgcolor', 'bold', 'italic', 'underline',
			'removeformat', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
			'insertunorderedlist', 'emoticons', 'image', 'link']
	});

	function zan(id) {
		var noteid=$("#noteid").val();
		var obj=$("#obj").val();
		var ids=id;
		$.ajax({
			url :  "${pageContext.servletContext.contextPath}/com/zan",
			data:{"comid":id},
			type : "post",
			success : function (likes) {
				//console.log(likes);
				//$(".em").html(likes);
				window.location.href = "${pageContext.servletContext.contextPath}/note/detail?id="+noteid;
			}
		});
	}

</script>
</body>
</html>